﻿using DLUProject.Domain;
using DLUProject.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class KTX_ThongTinSinhVien : BaseUserControl
{
    public SinhVienExtension _sinhVienExt { get; set; }
    public SinhVienPhongModel Model { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        Page.Title = "Trang thông tin sinh vien";
        if (!IsPostBack)
        {
            if (Session["SinhVien"] == null)
                Response.Redirect("Default.aspx?tab=dangnhap");

            var sv = (SinhVien)Session["SinhVien"];
            if (sv == null)
                Response.Redirect("Default.aspx?tab=dangnhap");
            Model = _sinhVienExt.GetThongTinSinhVien(sv.IDSinhVien);
            if (Model == null)
            {
                Response.Redirect("Default.aspx?tab=dangnhap");
            }
            if (Model.Phong == null)
            {
                //  Label1.Text = "Sinh vien này chưa được xếp phòng.";
            }
        }
    }
     
    protected void btnLogoff_ServerClick(object sender, EventArgs e)
    {
        Session.Remove("SinhVien");
        Response.Redirect("Default.aspx");
    }
}